//
//  FileManage.mm
//  ZeroGravity
//
//  Created by wei huang on 09-1-8.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "FileManage.h"


@implementation FileManage

+(BOOL) IsExistDirectory:(NSString *) strDirectory
{
	BOOL flag = YES; 
	NSFileManager *fileManager = [ NSFileManager defaultManager ] ;
	return [fileManager fileExistsAtPath:strDirectory isDirectory:&flag ] ;
	
}
+ (NSString*)GetPowerSearchPath
{
	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
	NSFileManager *fileManager = [NSFileManager defaultManager];
	NSString *strSearchPath = [NSString stringWithString:[paths objectAtIndex:0]] ; 
	if ( [FileManage IsExistDirectory:strSearchPath] )
		return strSearchPath ; 
	else
	{
		if( [fileManager createDirectoryAtPath:strSearchPath attributes:nil] )
		{
			return strSearchPath;		
		}
		return nil ; 
	}
}
+ (BOOL) IsExistFile:(NSString *) strFileName
{
	NSFileManager *fileManager = [ NSFileManager defaultManager ] ;
	if ( [fileManager fileExistsAtPath:strFileName ] == NO) 
		return NO;
	return YES;
}

@end
